package com.senlingspace.web.controller.weixin.mini;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.senlingspace.common.annotation.RepeatSubmit;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.senlingspace.common.annotation.Log;
import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.common.enums.BusinessType;
import com.senlingspace.system.domain.SlkjWechatSmall;
import com.senlingspace.system.service.ISlkjWechatSmallService;
import com.senlingspace.common.utils.poi.ExcelUtil;
import com.senlingspace.common.core.page.TableDataInfo;

/**
 * 小程序品牌故事图片Controller
 *
 * @author wangliang
 * @date 2024-12-03
 */
@RestController
@RequestMapping("/system/small")
public class SlkjWechatSmallController extends BaseController
{
    @Autowired
    private ISlkjWechatSmallService slkjWechatSmallService;

    /**
     * 查询小程序品牌故事图片列表
     */
    @PreAuthorize("@ss.hasPermi('system:small:list')")
    @GetMapping("/list")
    public TableDataInfo list(SlkjWechatSmall slkjWechatSmall)
    {
        startPage();
        List<SlkjWechatSmall> list = slkjWechatSmallService.selectSlkjWechatSmallList(slkjWechatSmall);
        return getDataTable(list);
    }

    /**
     * 获取小程序品牌故事图片详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:small:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(slkjWechatSmallService.selectSlkjWechatSmallById(id));
    }

    /**
     * 新增小程序品牌故事图片
     */
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    @PreAuthorize("@ss.hasPermi('system:small:add')")
    @Log(title = "小程序品牌故事图片", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SlkjWechatSmall slkjWechatSmall)
    {
        return toAjax(slkjWechatSmallService.insertSlkjWechatSmall(slkjWechatSmall));
    }

    /**
     * 修改小程序品牌故事图片
     */
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    @PreAuthorize("@ss.hasPermi('system:small:edit')")
    @Log(title = "小程序品牌故事图片", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SlkjWechatSmall slkjWechatSmall)
    {
        return toAjax(slkjWechatSmallService.updateSlkjWechatSmall(slkjWechatSmall));
    }

    /**
     * 删除小程序品牌故事图片
     */
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    @PreAuthorize("@ss.hasPermi('system:small:remove')")
    @Log(title = "小程序品牌故事图片", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(slkjWechatSmallService.deleteSlkjWechatSmallByIds(ids));
    }
}
